-
Notifications
You must be signed in to change notification settings - Fork 329
FIX: ISXB-1584, ISXB-1688, ISXB-1692, ISXB-1693, ISXB-1694, ISXB-1701 InputActionReference bug fixes and improved test coverage. #2248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…been called and cached, then Set and then calling action again.
This solves the incorrect return value, but it seems it is not enough to solve the reported problem so moving this back to draft mode for more work. |
…onReference, simplification of InputActionImporter.
…g fixing of InputActionReference, added more tests.
…to support serialization within editor test. Added test utilities.
…echnologies/InputSystem into isxb-1584-input-action-reference
…ork since referencing editor types.
… InputActionReference unless there is a UI to configure it
…ained actions intact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the change to my bug fix and skimmed though some of the other changes.
{ | ||
DumpReferences(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be part of our Input Debugger interface instead?
Description
Fixes the following issues:
InputActionReference.action
would return an incorrect (cached) action if set programmatically after the cached instance had been resolved.InputActionSetupExtensions.RemoveAction(action)
throws exception if attempting to remove an action that doesn't have any bindings.InputActionReference.Set
in playmode corrupts the referenced asset.InputActionReference.Create(null)
returns null instead "of a reference object to the given action".InputActionReference.Set(null)
does not update the cached input action reference nor theScriptableObject.name
leading to incorrect action being returned and reference showing up as the path to the previously assigned action in Inspector.ISXB-1699 -This was a misinterpretation and have been reverted. Ticket marked "As Designed".InputActionAsset.RemoveActionMap
doesn't remove actions within the map, leaving them with stale references back to the map.InputActionReference
isn't reflecting broken reference in case action is deleted from asset, action map is deleted from asset or the asset itself is deleted.Revisiting/altering fixes of the previous tickets:
The above revisited tickets reference the problem of InputActionReference run-time objects not being reset when exiting play-mode with domain reloads disabled. To get this scenario covered, this scenario is now included in the added editor tests. Tested both with and without domain reloads enabled.
Additional changes made:
InputActionReference
in that class as long as there is no UI to edit it implemented. If such a UI is added later it can easily be converted back toInputActionReference
.InputActionReference
to eliminate name-shadowing warnings. Didn't touch public ones since a parameter rename would be unexpected after API publishing.InputActionReference
instances from assets withinInputActionImporter
.EditorPrefsTestUtils.cs
which is a test utility to simplify editor tests.CoreTests_Actions_References.cs
which extracts previous and newInputActionReference
play-mode tests into their own (partial) file.DumpInputActionReferences.cs
which extends "QA Tools" with ability to dump a list of all input action references (loaded + assets) into the console via QA Tools Unity menu.Open issues/questions to reviewers:
Testing status & QA
Added a bunch of functional tests that replicates the problematic scenarios mentioned above. Both play-mode functional tests as well as edit-mode as well as transitional editor-mode to play-mode and play-mode to edit-mode editor tests were added.
Removed some code related to project-wide-actions in property drawer I believe @jfreire-unity added. I do not think it is needed as a special case anymore and I also think it was incorrect to change the users objects.
Altered a previous play-mode fix by @timkeo but it is essentially intact to previous behavior. I think there is opportunity to change this later to only use Object.FindObjectsByType(true) instead of Resources.FindObjectsByType() as an optimisation after this has landed?
Haven''t tested on 2021.3 which might be behaving differently but I do not know if we should bother since it is soon EoL.
Overall Product Risks
InputActionReferences are used all over the place so this is a serious bug that can have impact, especially on more complex projects.
Comments to reviewers
Recommend double checking the repro project with this fix.
Checklist
Before review:
Changed
,Fixed
,Added
sections.Actions_CanResolveActionReferenceAndThenSetItToAnotherAction
During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: